package leetcode.N801_N900;

import leetcode.comm.ListNode;

public class N876 {

    public static void main(String[] args) {

        ListNode head = ListNode.generate(1);
        System.out.println(middleNode(head));
    }

    static ListNode middleNode(ListNode head) {
        ListNode mid = head;
        for (ListNode n = head; n != null && n.next != null; n = n.next.next) {
            mid = mid.next;
        }
        return mid;
    }

}
